POI Maintenance
pois <- st_read(paste0(path_pois,"gis_osm_pois_a_free_1.shp"))
pois_filter <- pois %>%
rename(amenity = fclass) %>%
filter(amenity %in% c(
"community_centre",
"convenience",
"fast_food",
"supermarket",
"park",
"green grocer", #was not captured in poi data for bay area
"playground",
"kindergarten",
"school",
"library"#,
#"tram_stop", was not captured in poi data for bay area
#"bus_stop" was not captured in poi data for bay area
))
pois_filter_summary <- pois_filter %>%
st_drop_geometry() %>%
group_by(amenity) %>%
count() %>%
arrange(desc(n))
pois_filter_summary
mapview(pois_filter, zcol = "amenity")
# saveRDS(pois_filter, "/Volumes/GoogleDrive/.shortcut-targets-by-id/1i5yZPOBgJfC_blys_kNUJn1-FfLWoyiO/Assignments/2A/data/pois_filter.rds")
pois_filter <- readRDS(paste0(path_data,"pois_filter.rds"))
Area of Interest -
alm_cbgs <- block_groups("CA","Alameda",2020)
Oak_boundary <- places("CA",2020) %>%
filter(NAME == "Oakland")
Oak_cbgs <- alm_cbgs %>%
st_centroid() %>%
.[Oak_boundary, ] %>%
st_drop_geometry() %>%
left_join(alm_cbgs %>% select(GEOID)) %>%
st_as_sf()
mapview(Oak_cbgs)
WOak_cbgs <- Oak_cbgs[c(87, 86, 88, 95, 159, 103, 102, 38, 41, 40, 39, 34, 169, 106, 105, 104, 101,
288, 290, 289, 37, 36, 35),] #pulled from map of block groups
alm_blk <- blocks("CA","Alameda",2020)
WOak_blk <- alm_blk %>%
st_centroid() %>%
.[WOak_cbgs, ] %>%
st_drop_geometry() %>%
left_join(alm_blk %>% select(GEOID20)) %>%
st_as_sf()
#saveRDS(WOak_blk, "/Volumes/GoogleDrive/.shortcut-targets-by-id/1i5yZPOBgJfC_blys_kNUJn1-FfLWoyiO/Assignments/2A/data/WestOaklandBlocks.rds")
WOak_blk <- readRDS(paste0(path_data,"WestOaklandBlocks.rds"))
isochrones <- c("walking","cycling","driving") %>%
map_dfr(function(x){
mb_isochrone(
WOak_blk,
profile = x,
time = c(5,10,15)
) %>%
mutate(mode = x)
})
#saveRDS(isochrones, "/Volumes/GoogleDrive/.shortcut-targets-by-id/1i5yZPOBgJfC_blys_kNUJn1-FfLWoyiO/Assignments/2A/data/WOak_isochrones.rds")
isochrones <- readRDS(paste0(path_data,"WOak_isochrones.rds"))
mapview(WOak_blk)
mapview(isochrones %>% filter(mode == "walking"))
mapview(pois_filter, zcol = "amenity")